package com.hyw.supply.model.query;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;


/**
 * @author zengzhiping
 * @ClassName CommonEntity
 * @Description 公告分页参数
 * @createTime 2022年05月12日
 */
@Data
public abstract class BaseCommonPage implements Serializable {

    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * 条数
     */
    @Schema(title = "size", description = "每页条数,默认10")
    private Integer size = 10;

    /**
     * 当前页
     */
    @Schema(title = "page", description = "页码,默认1")
    private Integer page = 1;

    /**
     * 转换为page对象
     *
     * @param <T>
     * @return
     */
    public <T> Page toPage() {
        Page<T> page = new Page<>();
        page.setSize(this.size);
        page.setCurrent(this.page);
        return page;
    }
}
